package com.zlq.cn.controller.sign.ai;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zlq.cn.api.SignApiResult;
import com.zlq.cn.controller.BaseController;
import com.zlq.cn.entity.TianDataSave;
import com.zlq.cn.entity.YoudaoCorrectWriting;
import com.zlq.cn.service.ai.YoudaoCorrectWritingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhoucl
 * @since 2022-03-05
 */
@Api(tags = "有道")
@RestController
@Validated
@RequestMapping("/youdao")
public class YoudaoController extends BaseController {

    @Resource
    private YoudaoCorrectWritingService youdaoCorrectWritingService;

    @ApiOperation(value = "有道公共查询接口")
    @ApiImplicitParam(name = "type", value = "数据类型，correct_writing_cn_image：中文作文批改（图像识别），correct_writing_cn_text：中文作文批改（文本输入）", paramType = "form", required = true)
    @PostMapping("/openapi")
    public SignApiResult<YoudaoCorrectWriting> openapi(@ApiIgnore @RequestBody HashMap<String, Object> param) {
        return SignApiResult.resultSuccess(youdaoCorrectWritingService.openapi(param));
    }

    @ApiOperation(value = "有道列表", notes = "注意必须带上分页参数；current、size")
    @ApiImplicitParam(name = "type", value = "数据类型，correct_writing_cn_image：中文作文批改（图像识别），correct_writing_cn_text：中文作文批改（文本输入）", paramType = "form", required = true)
    @PostMapping("/list")
    public SignApiResult<Page<YoudaoCorrectWriting>> list(@ApiIgnore @RequestBody YoudaoCorrectWriting param) {
        return SignApiResult.resultSuccess(youdaoCorrectWritingService.list(super.getPage(), param));
    }
}

